<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>忘记密码</title>
    <link rel="stylesheet" href="css/login_reg.css" type="text/css">
    <script src="js/jquery-3.3.1.js"></script>
    <script>
        //页面加载函数
        $(function (){
            //1.给登录按钮添加单击事件
            $("#sub").click(function (){
                //2.使用ajax发送请求 - 提交表单数据
                $.post(
                    //uri
                    "/music/user/sendEmail",
                    //参数
                    $("#forgetForm").serialize(),
                    //回调函数
                    function (data){
                        if (data.flag){
                            //用户名和邮箱匹配,跳转到验证码比较
                            location.href = "compare.html";
                        }else {
                            //匹配失败
                            $("#errorMsg").html(data.errorMsg);
                        }
                    },"json");
                //3.处理响应结果
            });
        });
    </script>
</head>
<body class="login-bg">

<div class="login">
    <div class="message">忘记密码
    </div>
    <div id="darkbannerwrap"></div>
    <form id="forgetForm"  method="post" >
        <input name="username" placeholder="用户名"  type="text"  >
        <hr class="hr15">
        <input name="userEmail" placeholder="邮箱"  type="text" >
        <hr class="hr15">
        <input type="button" id="sub" value="下一步">
        <hr class="hr20" >
        <div id="errorMsg" style="margin: 0 auto ; text-align: center"></div>
    </form>
    <div>
        <a href="userlogin.html" style="float: left">登录</a>
    </div>
</div>